package com.maple.model

/**
  * author: HuaZhe Ray
  *
  * describe: 学科类
  *
  * createDate: 2017/12/7
  * createTime: 17:44
  *
  */
//class Lesson (val name: String/*,val point:Int, val rank:Char*/) {
case class Lesson ( name: String, point:Int = 0/*, val rank:Char*/) {

//    var point:Int = 0
//    var rank:Char = 'A'

  def sumRank(point:Int) = point match {
    case i if i >= 90  => 'A'
    case i if i >= 75 && i < 90  => 'B'
    case i if i >= 60 && i < 75  => 'C'
    case _   => 'D'
  }

  var rank = sumRank(point)

  override def toString: String = "Lesson:[ name: "+name + " point: "+point+" rank: "+rank+ " ]"

   /*def this(name:String,point:Int) {
      this(name)
      this.point = point
      rank = sumRank(point)
  }*/
}
